<template>
  <div class="operation-edit-container">
    <el-card class="box-card">
      <div slot="header" class="card-header">
        <span>基本信息</span>
      </div>
      <el-form ref="form" label-width="100px" size="mini" class="requirement-form">
        <el-row>
          <el-col :span="8">
            <el-form-item label="用户名称:">{{form.creatorName}}</el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="操作类型:">{{logTypeShow(form.logType)}}</el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="操作对象:">{{form.logObject}}</el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="操作时间:">{{form.createTime}}</el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="访问路径:">{{form.logUrl}}</el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <div class="continer">
      <div class="header">日志内容</div>
      <div class="txt">{{form.logInfo}}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "needEdit",
  data() {
    return {
      logTypeArr: [
        {
          value: 1,
          label: "新增"
        },
        {
          value: 2,
          label: "删除"
        },
        {
          value: 3,
          label: "更新"
        },
        {
          value: 4,
          label: "查询"
        },
        {
          value: 5,
          label: "导出"
        }
      ], // 操作类型
      form: {}
    };
  },
  components: {},
  computed: {},
  created() {
    this.handleQueryRequirement();
  },
  mounted() {},
  methods: {
    logTypeShow(val) {
      let str = "";
      this.logTypeArr.map(_i => {
        if (_i.value == val) {
          str = _i.label;
        }
      });
      return str;
    },
    // 查询需求详情
    async handleQueryRequirement() {
      let { id } = this.$route.query;
      let res = await this.$operationApi.logQuery({ id });
      if (res&&res.success) {
          this.form = res.value;
        // this.form = {
        //   id: "9709",
        //   logType: 1,
        //   logObject: "事件概览",
        //   logInfo: "AAAA",
        //   logUrl: "http://localhost:8080/#/operation/list/item?id=9709",
        //   userId: "AAAA",
        //   creatorName: "joker",
        //   remark: "AAAA",
        //   org_code: "AAAA",
        //   createTime: "2021-07-08 01:49:22"
        // };
      }
    }
  },
  watch: {}
};
</script>

<style lang="scss">
.continer {
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  border: 1px solid #ebeef5;
  background-color: #ffffff;
  overflow: hidden;
  color: #303133;
  transition: 0.3s;
  margin-top: 20px;
  .header {
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid #ebeef5;
    box-sizing: border-box;
  }
  .txt {
    width: 98%;
    margin: 10px auto;
    min-height: 1rem;
    text-indent: 20px;
    line-height: 30px;
    word-wrap: break-word;
    letter-spacing: 1px;
  }
}
.operation-edit-container {
  .el-card__body {
    padding: 0;
  }

  .el-form.requirement-form {
    padding: 20px 0;
  }

  .tab-card {
    margin-top: 15px;
    position: relative;
  }
}
</style>
